package com.anyou.mall.order.orderGoods.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.anyou.common.annotation.Log;
import com.anyou.common.core.controller.BaseController;
import com.anyou.common.core.domain.ApiResult;
import com.anyou.common.enums.BusinessType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.anyou.mall.order.orderGoods.domain.OrdOrderGoods;
import com.anyou.mall.order.orderGoods.service.IOrdOrderGoodsService;
import com.anyou.common.utils.poi.ExcelUtil;
import com.anyou.common.core.page.TableDataInfo;

/**
 * 订单商品Controller
 *
 * @author xq
 * @date 2022-03-28
 */
@Api(tags = "订单商品")
@RestController
@RequestMapping("/ord/orderGoods")
public class OrdOrderGoodsController extends BaseController
{
    @Autowired
    private IOrdOrderGoodsService ordOrderGoodsService;

    /**
     * 查询订单商品列表
     *//*
    @ApiOperation("查询订单商品列表")
    @PreAuthorize("@ss.hasPermi('ord:orderGoods:list')")
    @GetMapping("/list")
    public TableDataInfo<List<OrdOrderGoods>> list(OrdOrderGoods ordOrderGoods)
    {
        startPage();
        List<OrdOrderGoods> list = ordOrderGoodsService.selectOrdOrderGoodsList(ordOrderGoods);
        return getDataTable(list);
    }

    *//**
     * 导出订单商品列表
     *//*
    @ApiOperation("导出订单商品列表")
    @PreAuthorize("@ss.hasPermi('ord:orderGoods:export')")
    @Log(title = "订单商品", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, OrdOrderGoods ordOrderGoods)
    {
        List<OrdOrderGoods> list = ordOrderGoodsService.selectOrdOrderGoodsList(ordOrderGoods);
        ExcelUtil<OrdOrderGoods> util = new ExcelUtil<OrdOrderGoods>(OrdOrderGoods.class);
        util.exportExcel(response, list, "订单商品数据");
    }

    *//**
     * 获取订单商品详细信息
     *//*
    @ApiOperation("获取订单商品详细信息")
    @PreAuthorize("@ss.hasPermi('ord:orderGoods:query')")
    @GetMapping(value = "/{orderGoodsId}")
    public ApiResult<OrdOrderGoods> getInfo(@PathVariable("orderGoodsId") Long orderGoodsId)
    {
        return ApiResult.success(ordOrderGoodsService.selectOrdOrderGoodsByOrderGoodsId(orderGoodsId));
    }

    *//**
     * 新增订单商品
     *//*
    @ApiOperation("新增订单商品")
    @PreAuthorize("@ss.hasPermi('ord:orderGoods:add')")
    @Log(title = "订单商品", businessType = BusinessType.INSERT)
    @PostMapping
    public ApiResult add(@RequestBody OrdOrderGoods ordOrderGoods)
    {
        return ApiResult.success(ordOrderGoodsService.insertOrdOrderGoods(ordOrderGoods));
    }

    *//**
     * 修改订单商品
     *//*
    @ApiOperation("修改订单商品")
    @PreAuthorize("@ss.hasPermi('ord:orderGoods:edit')")
    @Log(title = "订单商品", businessType = BusinessType.UPDATE)
    @PutMapping
    public ApiResult edit(@RequestBody OrdOrderGoods ordOrderGoods)
    {
        return ApiResult.success(ordOrderGoodsService.updateOrdOrderGoods(ordOrderGoods));
    }

    *//**
     * 删除订单商品
     *//*
    @ApiOperation("删除订单商品")
    @PreAuthorize("@ss.hasPermi('ord:orderGoods:remove')")
    @Log(title = "订单商品", businessType = BusinessType.DELETE)
    @DeleteMapping("/{orderGoodsIds}")
    public ApiResult remove(@PathVariable Long[] orderGoodsIds)
    {
        return ApiResult.success(ordOrderGoodsService.deleteOrdOrderGoodsByOrderGoodsIds(orderGoodsIds));
    }*/
}
